



********************************************************
** Figure 3
********************************************************

global data="C:\CFLs\Data\"
global outputs="C:\CFLs\Outputs\"

clear
clear matrix
clear mata

set maxvar 10000
cd "$data"

global format=`"nogap label nostar starlevels(* 0.1 ** 0.05 *** 0.01) collabels(none) cells(b(star fmt(3) label(Coef.)) se(par fmt(3) label(Std.Err.))) csv"'
global statsFEshort=`"stats(N r2, fmt(0 a2) labels("Observations" "R-squared")) "'



use "CFLs_data.dta" , clear


gen outages_hist=.
replace outages_hist=0 if  s5_17_f==0 
replace outages_hist=1 if  s5_17_f>0 & s5_17_f<5
replace outages_hist=2 if  s5_17_f>4 & s5_17_f<10
replace outages_hist=3 if  s5_17_f>9 & s5_17_f<15
replace outages_hist=4 if  s5_17_f>14

label var tg_treated "Tranformer treatment status"


* By transformer treatment 
histogram outages_hist, discrete width(1) percent fcolor(green) lcolor(green) gap(5) ytitle(Percent of reponses) ylabel(#5) xtitle(Number days without electricity (in past month)) xlabel(0 "0" 1 " 1 to 4" 2 "5 to 9" 3 "10 to 14" 4 "15+", format(%-12s) alternate) by(tg_treated)
